import request from '@/utils/request'


export function getQuestionList(page) {
  /*
  * 获取题目列表
  * */
  return request({
    method: 'get',
    url: page ? `/question?page=${page}` : '/question',
  });
}

export function deleteQuestion(id) {
  /*
  * 根据id删除某个题目
  * */
  return request({
    method: 'delete',
    url: '/question',
    params: {id}
  })
}

export function toAddOrAlterQues({id, title, sort, answers}) {
  /*
  * 添加或者修改题目
  *
  * */
  return request({
    method: 'post',
    url: '/question',
    data: {id, title, sort, answers}
  })
}

export function getQuestionDetail(id) {
  /*
  * 获取题目详情
  * */
  return request({
    method: 'get',
    url: `/question/${id}`
  })
}
